POV-Ray : Newsgroups : povray.advanced-users : Object Oriented POV code : Re: Object Oriented POV code Server Time
29 Jul 2024 08:21:19 EDT (-0400)
  Re: Object Oriented POV code  
From: Warp
Date: 20 Feb 2004 05:52:14
Message: <4035e6de@news.povray.org>
Dan P <dan### [at] yahoocom> wrote:
> To create the object dynamically without the new keyword, the interpreter
> would need to look up whether what proceeds it is a Class or something that
> the user already defined. That would not effect small scenes, but in scenes
> with hundreds of thousands of objects, it would show in the parse time. By
> using new, the interpreter /knows/ that what follows it is a class.

  Believe it or not, there are faster ways of searching than linear search.

  Even if you have 4000 millions of names, you can find a specific one
by doing at most 32 comparisons.
  In the same way, adding a new name to the set of existing names requires
at most 32 comparisons and other operations.

  Besides, what does it help to tell the interpreter that "what follows is
a type"? By that you can at best just cut the amount of items to search
to half (to 2000 millions in the example above).

> I think it would be a really good idea to make everything an instance of a
> class.

  There's a reason why in Java everything is not an instance of a class.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.